(C++) Check for iterators used outside their valid ranges.